home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Pararena 1.3 / source / Parts ƒ / Utilities.p < prev   
Encoding:
Text File  |  1991-05-17  |  31.6 KB  |  1,091 lines  |  [TEXT/PJMM]

  1. unit Utilities;
  2.  
  3. interface
  4.  
  5.     uses
  6.         Sound, Globals, Unlock;
  7.  
  8.     procedure ResetTitleVars;
  9.     procedure DoErrorSound (soundNumber: Integer);
  10.     procedure DoJets;
  11.     procedure BeamInPlayer (us: Boolean; var who: dynaMap);
  12.     function DoRandom (range: Integer): Integer;
  13.     procedure DoTheSound (whichOne: Str255; priority: Integer);
  14.     procedure FireBall;
  15.     procedure PlayerOutOfArena;
  16.     procedure PlayerInTransit;
  17.     procedure OpponentOutOfArena;
  18.     procedure OpponentInTransit;
  19.     function LapsedTime: LongInt;
  20.     procedure BallOutOfArena;
  21.     procedure DoHolding;
  22.     procedure DrawEarthScore;
  23.     procedure DrawTaygeteScore;
  24.     procedure DoAScore (whoseGoal: Integer);
  25.     procedure DrawPlayerOpponent;
  26.     procedure DrawOpponentPlayer;
  27.     procedure DrawPlayer;
  28.     procedure DrawPlayerAndBall;
  29.     procedure DisplayTime (timeIs: LongInt);
  30.     procedure DrawFouls (fouls, who: Integer);
  31.     procedure DoGameOver;
  32.     procedure SetUpMouseForce;
  33.     procedure HideMenuBar;
  34.     procedure ShowMenuBar;
  35.  
  36. implementation
  37.  
  38. {=================================}
  39.  
  40.     procedure ResetTitleVars;
  41.         const
  42.             leftEdge = -12000;
  43.             topEdge = -12000;
  44.         var
  45.             index: Integer;
  46.     begin
  47.         jetsOut := FALSE;
  48.         for index := 0 to 7 do
  49.             with titleLetters[index] do
  50.                 begin
  51.                     posX := leftEdge + 3000 * index;
  52.                     posZ := topEdge;
  53.                     velX := 10 * (DoRandom(100) - 50);
  54.                     velZ := DoRandom(100) - 50;
  55.                     screenH := centerH + posX div 100;
  56.                     HLock(Handle(vertTable));
  57.                     screenV := vertTable^^.data[ABS(posX div 300), posZ div 300];
  58.                     HUnlock(Handle(vertTable));
  59.                     if index = 0 then
  60.                         SetRect(dest, screenH - 14, screenV - 33, screenH + 14, screenV)
  61.                     else
  62.                         SetRect(dest, screenH - 13, screenV - 25, screenH + 13, screenV);
  63.                     oldDest := dest;
  64.                 end;
  65.     end;
  66.  
  67. {=================================}
  68.  
  69.     procedure DoErrorSound;
  70.         var
  71.             dummyLong: LongInt;
  72.             tempVolume, i: Integer;
  73.     begin
  74.         GetSoundVol(tempVolume);
  75.         if (tempVolume <> 0) then
  76.             for i := 0 to soundNumber do
  77.                 begin
  78.                     FlashMenuBar(0);
  79.                     Delay(8, dummyLong);
  80.                     FlashMenuBar(0);
  81.                 end;
  82.     end;
  83.  
  84. {=================================}
  85.  
  86.     procedure DoJets;
  87.         var
  88.             tempRect: Rect;
  89.     begin
  90.         OffsetRect(jetsRects[2], 4, 0);
  91.         tempRect := jetsRects[2];
  92.         tempRect.left := tempRect.left - 4;
  93.         CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil);
  94.         CopyMask(offEnemyMap, offEnemyMap, offLoadMap, jetsRects[0], jetsRects[1], jetsRects[2]);
  95.         CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn);
  96.         if (tempRect.left > 512) then
  97.             jetsOut := FALSE;
  98.     end;
  99.  
  100. {=================================}
  101.  
  102.     procedure BeamInPlayer;
  103.         var
  104.             howRezzed: Integer;
  105.     begin
  106.         mad := FALSE;
  107.         with who do
  108.             begin
  109.                 mode := mode + 1;
  110.                 howRezzed := mode div 6;
  111.                 CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  112.                 if (us) then
  113.                     CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[howRezzed], dest)
  114.                 else
  115.                     CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[howRezzed], dest);
  116.                 CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  117.                 if (mode > 22) then
  118.                     mode := resting;
  119.             end;
  120.     end;
  121.  
  122. {=================================}
  123.  
  124.     function DoRandom;
  125.         var
  126.             rawResult: LongInt;
  127.     begin
  128.         rawResult := ABS(Random);
  129.         DoRandom := (rawResult * range) div 32768;
  130.     end;
  131.  
  132. {=================================}
  133.  
  134.     function GetA5: LONGINT;
  135.     inline
  136.         $2E8D; {MOVE.L A5,(A7)}
  137.  
  138. {=================================}
  139.  
  140.     function LoadA5 (newA5: LONGINT): LONGINT;
  141.     inline
  142.         $2F4D, $0004, $2A5F;
  143.  
  144. {=================================}
  145.  
  146.     procedure ChanCallBack (chan: SndChannelPtr; cmd: SndCommand);
  147.         var
  148.             oldA5: LongInt;
  149.     begin
  150.         if cmd.param1 <> 12345 then
  151.             Exit(ChanCallBack);             { Skip err callBackCmd w/ System 6.0.4 }
  152.         oldA5 := LoadA5(cmd.param2);        { get the application's A5 and set it }
  153.         soundPriority := noSound;
  154.         oldA5 := LoadA5(oldA5);            { restore old A5 }
  155.     end;
  156.  
  157. {=================================}
  158.  
  159.     procedure DoTheSound;
  160.         var
  161.             aCommand: SndCommand;
  162.             err: OSErr;
  163.     begin
  164.         if (not soundOn) then
  165.             Exit(DoTheSound);
  166.  
  167.         if (priority < soundPriority) then
  168.             Exit(DoTheSound);
  169.  
  170.         soundPriority := priority;
  171.  
  172.         theSnd := GetNamedResource('snd ', whichOne);
  173.         if (theSnd^ = nil) then
  174.             Exit(DoTheSound);
  175.  
  176.         if (chanPtr <> nil) then
  177.             begin
  178.                 with aCommand do
  179.                     begin
  180.                         cmd := quietCmd;
  181.                         param1 := 0;
  182.                         param2 := 0;
  183.                     end;
  184.                 err := SndDoImmediate(chanPtr, aCommand);
  185.                 err := SndDisposeChannel(chanPtr, TRUE);
  186.                 chanPtr := nil;
  187.             end;
  188.  
  189.         err := SndNewChannel(chanPtr, 0, 0, @ChanCallBack);
  190.         if (err = noErr) then
  191.             err := SndPlay(chanPtr, theSnd, TRUE);
  192.         with aCommand do
  193.             begin
  194.                 cmd := callBackCmd;
  195.                 param1 := 12345;
  196.                 param2 := GetA5;
  197.             end;
  198.         if (err = noErr) then
  199.             err := SndDoCommand(chanPtr, aCommand, FALSE);
  200.  
  201.     end;
  202.  
  203. {=================================}
  204.  
  205.     procedure FireBall;
  206.     begin
  207.         ballJustHit := FALSE;
  208.         clicked := FALSE;
  209.         lastTouchingBall := nooneHasBall;
  210.         with ball do
  211.             begin
  212.                 CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, wholeRgn);
  213.                 CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  214.                 mode := nooneHasBall;
  215.                 timeKeeper := -40;
  216.                 SetRect(dest, 1, 30, 1, 30);
  217.                 oldDest := dest;
  218.             end;
  219.         player.carryMode := notCarrying;
  220.     end;
  221.  
  222. {=================================}
  223.  
  224.     procedure PlayerOutOfArena;
  225.         var
  226.             lostBall: Boolean;
  227.     begin
  228.         mad := FALSE;
  229.         lostBall := FALSE;
  230.         if (ball.mode = playerHasBall) then
  231.             lostBall := TRUE;
  232.         if (lostBall) then
  233.             BallOutOfArena;
  234.         with player do
  235.             begin
  236.                 timeKeeper := -100;
  237.                 CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  238.                 CopyBits(offVirginMap, offLoadMap, oldDest, oldDest, srcCopy, nil);
  239.             end;
  240.     end;
  241.  
  242. {=================================}
  243.  
  244.     procedure PlayerInTransit;
  245.     begin
  246.         with player do
  247.             begin
  248.                 mode := resting;
  249.                 case timeKeeper of
  250.                     -100: 
  251.                         begin
  252.                             if (soundArray[4]) then
  253.                                 DoTheSound('beamOut', highPriority);
  254.                             CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, wholeRgn);
  255.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  256.                             CopyBits(offVirginMap, offLoadMap, oldDest, oldDest, srcCopy, nil);
  257.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[3], dest);
  258.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  259.                         end;
  260.                     -99..-95: 
  261.                         begin
  262.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  263.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[3], dest);
  264.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  265.                         end;
  266.                     -94..-90: 
  267.                         begin
  268.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  269.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[2], dest);
  270.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  271.                         end;
  272.                     -89..-85: 
  273.                         begin
  274.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  275.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[1], dest);
  276.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  277.                         end;
  278.                     -84..-80: 
  279.                         begin
  280.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  281.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[0], dest);
  282.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  283.                         end;
  284.                     -79: 
  285.                         begin
  286.                             CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  287.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  288.                         end;
  289.                     -78..-22: 
  290.                         begin
  291.                         end;
  292.                     -21: 
  293.                         begin
  294.                             if (soundArray[4]) then
  295.                                 DoTheSound('beamIn', highPriority);
  296.                             velX := 0;
  297.                             velZ := 0;
  298.                             posX := -2000;
  299.                             posZ := 0;
  300.                             mode := resting;
  301.                             carryMode := notCarrying;
  302.                             screenH := centerH + posX div 100;
  303.                             HLock(Handle(vertTable));
  304.                             screenV := vertTable^^.data[ABS(posX div 300), posZ div 300] + 20;
  305.                             HUnlock(Handle(vertTable));
  306.                             SetRect(dest, screenH - 13, screenV - 45, screenH + 14, screenV);
  307.                             oldDest := dest;
  308.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  309.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[0], dest);
  310.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  311.                         end;
  312.                     -20..-16: 
  313.                         begin
  314.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  315.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[0], dest);
  316.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  317.                         end;
  318.                     -15..-11: 
  319.                         begin
  320.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  321.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[1], dest);
  322.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  323.                         end;
  324.                     -10..-6: 
  325.                         begin
  326.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  327.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[2], dest);
  328.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  329.                         end;
  330.                     -5..0: 
  331.                         begin
  332.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  333.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[3], dest);
  334.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  335.                         end;
  336.                     otherwise
  337.                 end;
  338.                 timeKeeper := timeKeeper + 1;
  339.             end;
  340.     end;
  341.  
  342. {=================================}
  343.  
  344.     procedure OpponentOutOfArena;
  345.         var
  346.             lostBall: Boolean;
  347.     begin
  348.         lostBall := FALSE;
  349.         if (ball.mode = opponentHasBall) then
  350.             lostBall := TRUE;
  351.         if (lostBall) then
  352.             BallOutOfArena;
  353.         with opponent do
  354.             begin
  355.                 timeKeeper := -100;
  356.                 CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  357.                 CopyBits(offVirginMap, offLoadMap, oldDest, oldDest, srcCopy, nil);
  358.             end;
  359.     end;
  360.  
  361. {=================================}
  362.  
  363.     procedure OpponentInTransit;
  364.     begin
  365.         with opponent do
  366.             begin
  367.                 mode := resting;
  368.                 case timeKeeper of
  369.                     -100: 
  370.                         begin
  371.                             if (soundArray[4]) then
  372.                                 DoTheSound('beamOut', highPriority);
  373.                             CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, wholeRgn);
  374.                             CopyBits(offVirginMap, offLoadMap, oldDest, oldDest, srcCopy, nil);
  375.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  376.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[3], dest);
  377.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  378.                         end;
  379.                     -99..-95: 
  380.                         begin
  381.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  382.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[3], dest);
  383.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  384.                         end;
  385.                     -94..-90: 
  386.                         begin
  387.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  388.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[2], dest);
  389.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  390.                         end;
  391.                     -89..-85: 
  392.                         begin
  393.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  394.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[1], dest);
  395.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  396.                         end;
  397.                     -84..-80: 
  398.                         begin
  399.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  400.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[0], dest);
  401.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  402.                         end;
  403.                     -79: 
  404.                         begin
  405.                             CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  406.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  407.                         end;
  408.                     -78..-22: 
  409.                         begin
  410.                         end;
  411.                     -21: 
  412.                         begin
  413.                             if (soundArray[4]) then
  414.                                 DoTheSound('beamIn', highPriority);
  415.                             velX := 0;
  416.                             velZ := 0;
  417.                             posX := 2000;
  418.                             posZ := 0;
  419.                             mode := resting;
  420.                             carryMode := notCarrying;
  421.                             screenH := centerH + posX div 100;
  422.                             HLock(Handle(vertTable));
  423.                             screenV := vertTable^^.data[ABS(posX div 300), posZ div 300] + 20;
  424.                             HUnlock(Handle(vertTable));
  425.                             SetRect(dest, screenH - 13, screenV - 45, screenH + 14, screenV);
  426.                             oldDest := dest;
  427.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  428.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, playerSrc[resting, 0], teleportMask[0], dest);
  429.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  430.                         end;
  431.                     -20..-16: 
  432.                         begin
  433.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  434.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[0], dest);
  435.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  436.                         end;
  437.                     -15..-11: 
  438.                         begin
  439.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  440.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[1], dest);
  441.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  442.                         end;
  443.                     -10..-6: 
  444.                         begin
  445.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  446.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[2], dest);
  447.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  448.                         end;
  449.                     -5..0: 
  450.                         begin
  451.                             CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil);
  452.                             CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[resting, 0], teleportMask[3], dest);
  453.                             CopyBits(offLoadMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  454.                         end;
  455.                     otherwise
  456.                 end;
  457.                 timeKeeper := timeKeeper + 1;
  458.             end;
  459.     end;
  460.  
  461. {=================================}
  462.  
  463.     function LapsedTime;
  464.     begin
  465.         currentTime := TickCount div 60;
  466.         LapsedTime := currentTime - startTime;
  467.     end;
  468.  
  469. {=================================}
  470.  
  471.     procedure DoAFoul;
  472.     begin
  473.         if (lastTouchingBall = playerHasBall) then
  474.             begin
  475.                 if (soundArray[2]) then
  476.                     DoTheSound('foul', highPriority);
  477.                 earthFouls := earthFouls + 1;
  478.                 if (earthFouls > 3) then
  479.                     begin
  480.                         earthFouls := 0;
  481.                         taygetePoints := taygetePoints + 1;
  482.                         if (soundArray[1]) then
  483.                             DoTheSound('crowd', highPriority);
  484.                         DrawTaygeteScore;
  485.                     end;
  486.                 DrawFouls(earthFouls, 0);
  487.             end
  488.         else if (lastTouchingBall = opponentHasBall) then
  489.             begin
  490.                 if (soundArray[2]) then
  491.                     DoTheSound('foul', highPriority);
  492.                 taygeteFouls := taygeteFouls + 1;
  493.                 if (taygeteFouls > 3) then
  494.                     begin
  495.                         taygeteFouls := 0;
  496.                         earthPoints := earthPoints + 1;
  497.                         if (soundArray[1]) then
  498.                             DoTheSound('crowd', highPriority);
  499.                         DrawEarthScore;
  500.                     end;
  501.                 DrawFouls(taygeteFouls, 1);
  502.             end;
  503.     end;
  504.  
  505. {=================================}
  506.  
  507.     procedure BallOutOfArena;
  508.     begin
  509.         CopyBits(offVirginMap, mainWndo^.portBits, ball.oldDest, ball.oldDest, srcCopy, wholeRgn);
  510.         DoAFoul;
  511.         FireBall;
  512.     end;
  513.  
  514. {=================================}
  515.  
  516.     procedure DoHolding;
  517.     begin
  518.         lastTouchingBall := ball.mode;
  519.         opponent.carryMode := notCarrying;
  520.         player.carryMode := notCarrying;
  521.         DoAFoul;
  522.         FireBall;
  523.     end;
  524.  
  525. {=================================}
  526.  
  527.     procedure DrawEarthScore;
  528.         var
  529.             digit1, digit2, digit3: Integer;
  530.     begin
  531.         digit1 := earthPoints div 100;
  532.         digit2 := (earthPoints - (digit1 * 100)) div 10;
  533.         digit3 := earthPoints - ((digit1 * 100) + (digit2 * 10));
  534.         if (digit1 = 0) then
  535.             digit1 := 11;
  536.         if ((digit1 = 11) and (digit2 = 0)) then
  537.             digit2 := 11;
  538.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit1], earthScoreDest[1], srcCopy, nil);
  539.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit2], earthScoreDest[2], srcCopy, nil);
  540.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit3], earthScoreDest[3], srcCopy, nil);
  541.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit1], earthScoreDest[1], srcCopy, nil);
  542.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit2], earthScoreDest[2], srcCopy, nil);
  543.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit3], earthScoreDest[3], srcCopy, nil);
  544.     end;
  545.  
  546. {=================================}
  547.  
  548.     procedure DrawTaygeteScore;
  549.         var
  550.             digit1, digit2, digit3: Integer;
  551.     begin
  552.         digit1 := taygetePoints div 100;
  553.         digit2 := (taygetePoints - (digit1 * 100)) div 10;
  554.         digit3 := taygetePoints - ((digit1 * 100) + (digit2 * 10));
  555.         if (digit1 = 0) then
  556.             digit1 := 11;
  557.         if ((digit1 = 11) and (digit2 = 0)) then
  558.             digit2 := 11;
  559.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit1], taygeteScoreDest[1], srcCopy, nil);
  560.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit2], taygeteScoreDest[2], srcCopy, nil);
  561.         CopyBits(offPlayerMap, offVirginMap, digitSrc[digit3], taygeteScoreDest[3], srcCopy, nil);
  562.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit1], taygeteScoreDest[1], srcCopy, nil);
  563.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit2], taygeteScoreDest[2], srcCopy, nil);
  564.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit3], taygeteScoreDest[3], srcCopy, nil);
  565.     end;
  566.  
  567. {=================================}
  568.  
  569.     procedure DoAScore;
  570.         var
  571.             tempWhole: Rect;
  572.     begin
  573.         with ball do
  574.             begin
  575.                 CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn);
  576.                 CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, wholeRgn);
  577.                 timeKeeper := -2;
  578.             end;
  579.  
  580.         if (whoseGoal = 20000) then
  581.             begin
  582.                 with player do
  583.                     begin
  584.                         UnionRect(oldDest, dest, tempWhole);
  585.                         CopyBits(offVirginMap, offLoadMap, tempWhole, tempWhole, srcCopy, nil);
  586.                         if (timeKeeper > -1) then
  587.                             CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[mode, carryMode], playerMask[mode, carryMode], dest);
  588.                         CopyBits(offLoadMap, mainWndo^.portBits, tempWhole, tempWhole, srcCopy, wholeRgn);
  589.                     end;
  590.                 earthPoints := earthPoints + 1;
  591.                 if (soundArray[1]) then
  592.                     DoTheSound('crowd', lowPriority);
  593.                 earthFouls := 0;
  594.                 DrawFouls(0, 0);
  595.                 DrawEarthScore;
  596.             end
  597.         else
  598.             begin
  599.                 if (whichGame > practiceWBall) then
  600.                     with opponent do
  601.                         begin
  602.                             UnionRect(oldDest, dest, tempWhole);
  603.                             CopyBits(offVirginMap, offLoadMap, tempWhole, tempWhole, srcCopy, nil);
  604.                             if (timeKeeper > -1) then
  605.                                 CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[mode, carryMode], playerMask[mode, carryMode], dest);
  606.                             CopyBits(offLoadMap, mainWndo^.portBits, tempWhole, tempWhole, srcCopy, wholeRgn);
  607.                         end;
  608.                 taygetePoints := taygetePoints + 1;
  609.                 if (soundArray[1]) then
  610.                     DoTheSound('crowd', lowPriority);
  611.                 taygeteFouls := 0;
  612.                 DrawFouls(0, 1);
  613.                 DrawTaygeteScore;
  614.             end;
  615.         FireBall;
  616.     end;
  617.  
  618. {=================================}
  619.  
  620.     procedure DrawPlayerOpponent;
  621.         var
  622.             ourMode: Integer;
  623.             wholePlayer, wholeOpponent, wholeBall: Rect;
  624.     begin
  625.         if (tileLit > -1) then
  626.             begin
  627.                 SetPort(offVirginPort);
  628.                 InvertRgn(tileRgns[tileLit, tileToggle]);
  629.             end;
  630.  
  631.         with ball do
  632.             if (timeKeeper = 0) then
  633.                 begin
  634.                     UnionRect(oldDest, dest, wholeBall);
  635.                     CopyBits(offVirginMap, offLoadMap, wholeBall, wholeBall, srcCopy, nil);
  636.                 end;
  637.         with player do
  638.             begin
  639.                 UnionRect(oldDest, dest, wholePlayer);
  640.                 CopyBits(offVirginMap, offLoadMap, wholePlayer, wholePlayer, srcCopy, nil);
  641.             end;
  642.         with opponent do
  643.             begin
  644.                 UnionRect(oldDest, dest, wholeOpponent);
  645.                 CopyBits(offVirginMap, offLoadMap, wholeOpponent, wholeOpponent, srcCopy, nil);
  646.             end;
  647.  
  648.         with ball do
  649.             if (timeKeeper = 0) then
  650.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, src, mask, dest);
  651.         with player do
  652.             if (timeKeeper > -1) then
  653.                 begin
  654.                     ourMode := carryMode;
  655.                     if ((Button) and (carryMode = notCarrying)) then
  656.                         ourMode := crouching;
  657.                     CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[mode, ourMode], playerMask[mode, ourMode], dest);
  658.                 end;
  659.         with opponent do
  660.             if (timeKeeper > -1) then
  661.                 begin
  662.                     CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[mode, carryMode], playerMask[mode, carryMode], dest);
  663.                 end;
  664.  
  665.         if (tileLit > -1) then
  666.             begin
  667.                 SetPort(mainWndo);
  668.                 InvertRgn(tileRgns[tileLit, tileToggle]);
  669.                 tileLit := tileLit + 1;
  670.                 if (tileLit > 5) then
  671.                     tileLit := -1;
  672.                 SetPort(offVirginPort);
  673.             end;
  674.  
  675.         with ball do
  676.             if (timeKeeper = 0) then
  677.                 begin
  678.                     CopyBits(offLoadMap, mainWndo^.portBits, wholeBall, wholeBall, srcCopy, ballVisRgn);
  679.                     oldDest := dest;
  680.                 end;
  681.         with player do
  682.             begin
  683.                 CopyBits(offLoadMap, mainWndo^.portBits, wholePlayer, wholePlayer, srcCopy, wholeRgn);
  684.                 oldDest := dest;
  685.             end;
  686.         with opponent do
  687.             begin
  688.                 CopyBits(offLoadMap, mainWndo^.portBits, wholeOpponent, wholeOpponent, srcCopy, wholeRgn);
  689.                 oldDest := dest;
  690.             end;
  691.     end;
  692.  
  693.  
  694. {=================================}
  695.  
  696.     procedure DrawOpponentPlayer;
  697.         var
  698.             ourMode: Integer;
  699.             wholePlayer, wholeOpponent, wholeBall: Rect;
  700.     begin
  701.         if (tileLit > -1) then
  702.             begin
  703.                 SetPort(offVirginPort);
  704.                 InvertRgn(tileRgns[tileLit, tileToggle]);
  705.             end;
  706.  
  707.         with ball do
  708.             if (timeKeeper = 0) then
  709.                 begin
  710.                     UnionRect(oldDest, dest, wholeBall);
  711.                     CopyBits(offVirginMap, offLoadMap, wholeBall, wholeBall, srcCopy, nil);
  712.                 end;
  713.         with opponent do
  714.             begin
  715.                 UnionRect(oldDest, dest, wholeOpponent);
  716.                 CopyBits(offVirginMap, offLoadMap, wholeOpponent, wholeOpponent, srcCopy, nil);
  717.             end;
  718.         with player do
  719.             begin
  720.                 UnionRect(oldDest, dest, wholePlayer);
  721.                 CopyBits(offVirginMap, offLoadMap, wholePlayer, wholePlayer, srcCopy, nil);
  722.             end;
  723.  
  724.         with ball do
  725.             if (timeKeeper = 0) then
  726.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, src, mask, dest);
  727.         with opponent do
  728.             if (timeKeeper > -1) then
  729.                 begin
  730.                     CopyMask(offEnemyMap, offPlayerMap, offLoadMap, opponentSrc[mode, carryMode], playerMask[mode, carryMode], dest);
  731.                 end;
  732.         with player do
  733.             if (timeKeeper > -1) then
  734.                 begin
  735.                     ourMode := carryMode;
  736.                     if ((Button) and (carryMode = notCarrying)) then
  737.                         ourMode := crouching;
  738.                     CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[mode, ourMode], playerMask[mode, ourMode], dest);
  739.                 end;
  740.  
  741.         if (tileLit > -1) then
  742.             begin
  743.                 SetPort(mainWndo);
  744.                 InvertRgn(tileRgns[tileLit, tileToggle]);
  745.                 tileLit := tileLit + 1;
  746.                 if (tileLit > 5) then
  747.                     tileLit := -1;
  748.                 SetPort(offVirginPort);
  749.             end;
  750.  
  751.         with ball do
  752.             if (timeKeeper = 0) then
  753.                 begin
  754.                     CopyBits(offLoadMap, mainWndo^.portBits, wholeBall, wholeBall, srcCopy, ballVisRgn);
  755.                     oldDest := dest;
  756.                 end;
  757.         with opponent do
  758.             begin
  759.                 CopyBits(offLoadMap, mainWndo^.portBits, wholeOpponent, wholeOpponent, srcCopy, wholeRgn);
  760.                 oldDest := dest;
  761.             end;
  762.         with player do
  763.             begin
  764.                 CopyBits(offLoadMap, mainWndo^.portBits, wholePlayer, wholePlayer, srcCopy, wholeRgn);
  765.                 oldDest := dest;
  766.             end;
  767.     end;
  768.  
  769. {=================================}
  770.  
  771.     procedure DrawPlayer;
  772.         var
  773.             ourMode: Integer;
  774.             wholePlayer: Rect;
  775.     begin
  776.         with player do
  777.             begin
  778.                 UnionRect(oldDest, dest, wholePlayer);
  779.                 CopyBits(offVirginMap, offLoadMap, wholePlayer, wholePlayer, srcCopy, nil);
  780.                 if (timeKeeper > -1) then
  781.                     begin
  782.                         ourMode := carryMode;
  783.                         if ((Button) and (carryMode = notCarrying)) then
  784.                             ourMode := crouching;
  785.                         CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[mode, ourMode], playerMask[mode, ourMode], dest);
  786.                     end;
  787.                 CopyBits(offLoadMap, mainWndo^.portBits, wholePlayer, wholePlayer, srcCopy, wholeRgn);
  788.                 oldDest := dest;
  789.             end;
  790.     end;
  791.  
  792. {=================================}
  793.  
  794.     procedure DrawPlayerAndBall;
  795.         var
  796.             ourMode: Integer;
  797.             wholePlayer, wholeBall: Rect;
  798.     begin
  799.         with ball do
  800.             if (timeKeeper = 0) then
  801.                 begin
  802.                     UnionRect(oldDest, dest, wholeBall);
  803.                     CopyBits(offVirginMap, offLoadMap, wholeBall, wholeBall, srcCopy, nil);
  804.                 end;
  805.         with player do
  806.             begin
  807.                 UnionRect(oldDest, dest, wholePlayer);
  808.                 CopyBits(offVirginMap, offLoadMap, wholePlayer, wholePlayer, srcCopy, nil);
  809.             end;
  810.  
  811.         with ball do
  812.             if (timeKeeper = 0) then
  813.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, src, mask, dest);
  814.         with player do
  815.             if (timeKeeper > -1) then
  816.                 begin
  817.                     ourMode := carryMode;
  818.                     if ((Button) and (carryMode = notCarrying)) then
  819.                         ourMode := crouching;
  820.                     CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerSrc[mode, ourMode], playerMask[mode, ourMode], dest);
  821.                 end;
  822.  
  823.         with ball do
  824.             if (timeKeeper = 0) then
  825.                 begin
  826.                     CopyBits(offLoadMap, mainWndo^.portBits, wholeBall, wholeBall, srcCopy, ballVisRgn);
  827.                     oldDest := dest;
  828.                 end;
  829.         with player do
  830.             begin
  831.                 CopyBits(offLoadMap, mainWndo^.portBits, wholePlayer, wholePlayer, srcCopy, wholeRgn);
  832.                 oldDest := dest;
  833.             end;
  834.     end;
  835.  
  836. {=================================}
  837.  
  838.     procedure DisplayTime;
  839.         var
  840.             digit1, digit2, digit3: Integer;
  841.     begin
  842.         digit1 := timeIs div 60;
  843.         timeIs := (timeIs mod 60);
  844.         digit2 := timeIs div 10;
  845.         digit3 := timeIs mod 10;
  846.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit1], timeDest[1], srcCopy, nil);
  847.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit2], timeDest[2], srcCopy, nil);
  848.         CopyBits(offPlayerMap, mainWndo^.portBits, digitSrc[digit3], timeDest[3], srcCopy, nil);
  849.     end;
  850.  
  851. {=================================}
  852.  
  853.     procedure DrawFouls;
  854.     begin
  855.         case fouls of
  856.             0: 
  857.                 begin
  858.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 1], foulDest[who, 1], srcCopy, nil);
  859.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 2], foulDest[who, 2], srcCopy, nil);
  860.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 3], foulDest[who, 3], srcCopy, nil);
  861.                 end;
  862.             1: 
  863.                 begin
  864.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 1], srcCopy, nil);
  865.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 2], foulDest[who, 2], srcCopy, nil);
  866.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 3], foulDest[who, 3], srcCopy, nil);
  867.                 end;
  868.             2: 
  869.                 begin
  870.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 1], srcCopy, nil);
  871.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 2], srcCopy, nil);
  872.                     CopyBits(offVirginMap, mainWndo^.portBits, foulDest[who, 3], foulDest[who, 3], srcCopy, nil);
  873.                 end;
  874.             3: 
  875.                 begin
  876.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 1], srcCopy, nil);
  877.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 2], srcCopy, nil);
  878.                     CopyBits(offPlayerMap, mainWndo^.portBits, foulSrc, foulDest[who, 3], srcCopy, nil);
  879.                 end;
  880.             otherwise
  881.                 begin
  882.                 end;
  883.         end;
  884.     end;
  885.  
  886. {=================================}
  887.  
  888.     procedure DoGameOver;
  889.  
  890. {-------------------}
  891.  
  892.         procedure DoHoopla;
  893.             var
  894.                 index: Integer;
  895.                 astroSrc, astroMask, astroDest, wholeAstro, oldAstro: Rect;
  896.         begin
  897.             repeat
  898.             until (soundPriority = noSound);
  899.             DoTheSound('crowd', lowPriority);
  900.             SetRect(astroSrc, 365, 91, 511, 147);
  901.             SetRect(astroMask, 365, 148, 511, 204);
  902.             SetRect(astroDest, 512, 201, 658, 257);
  903.             oldAstro := astroDest;
  904.             for index := 1 to 350 do
  905.                 begin
  906.                     UnionRect(astroDest, oldAstro, wholeAstro);
  907.                     CopyBits(offVirginMap, offLoadMap, wholeAstro, wholeAstro, srcCopy, nil);
  908.                     CopyMask(offEnemyMap, offEnemyMap, offLoadMap, astroSrc, astroMask, astroDest);
  909.                     CopyBits(offLoadMap, mainWndo^.portBits, wholeAstro, wholeAstro, srcCopy, wholeRgn);
  910.                     oldAstro := astroDest;
  911.                     OffsetRect(astroDest, -2, 0);
  912.                 end;
  913.  
  914.             if ((earthPoints > smallestGreatest) and (not locked)) then
  915.                 begin
  916.                     GetName(playerName);
  917.                     CopyBits(offVirginMap, mainWndo^.portBits, screenArea, screenArea, srcCopy, wholeRgn);
  918.                     DoGreatestScore;
  919.                     if ((earthPoints - taygetePoints) > smallestDelta) then
  920.                         DoDeltaScore;
  921.                     ShowHiScores;
  922.                 end
  923.             else if (((earthPoints - taygetePoints) > smallestDelta) and (not locked)) then
  924.                 begin
  925.                     GetName(playerName);
  926.                     CopyBits(offVirginMap, mainWndo^.portBits, screenArea, screenArea, srcCopy, wholeRgn);
  927.                     DoDeltaScore;
  928.                     ShowHiScores;
  929.                 end;
  930.             CopyBits(offVirginMap, mainWndo^.portBits, screenArea, screenArea, srcCopy, wholeRgn);
  931.         end;
  932.  
  933. {-------------------}
  934.  
  935.         procedure DoBummer;
  936.         begin
  937.             DoTheSound('crowd', lowPriority);
  938.  
  939.             if (taygetePoints > smallestGreatest) then
  940.                 DoGreatestScore;
  941.             if ((taygetePoints - earthPoints) > smallestDelta) then
  942.                 DoDeltaScore;
  943.         end;
  944.  
  945. {--------vvv--------}
  946.  
  947.     begin
  948.         InitCursor;
  949.         FlushEvents(everyEvent, 0);
  950.  
  951.         if (earthPoints > taygetePoints) then
  952.             DoHoopla
  953.         else if ((earthPoints = taygetePoints) and (earthFouls < taygeteFouls)) then
  954.             DoHoopla
  955.         else
  956.             DoBummer;
  957.  
  958.         EnableItem(GetMenu(mGame), iBegin);
  959.         DisableItem(GetMenu(mGame), iEnd);
  960.         EnableItem(GetMenu(mGame), iWhichGame);
  961.         EnableItem(GetMenu(mGame), iWhichOpponent);
  962.  
  963.         if (not locked) then
  964.             EnableItem(getMenu(mOptions), iPhysics);
  965.  
  966.         CopyBits(offVirginMap, mainWndo^.portBits, wholeScreen, wholeScreen, srcCopy, wholeRgn);
  967.         ShowMenuBar;
  968.         playing := FALSE;
  969.         pausing := FALSE;
  970.         justQuit := TRUE;
  971.     end;
  972.  
  973. {=================================}
  974.  
  975.     procedure SetUpMouseForce;
  976.     begin
  977.         mouseForce[south, 0] := 0;
  978.         mouseForce[south, 1] := TRUNC(1 * mouseConst);
  979.         mouseForce[southEast, 0] := TRUNC(0.707 * mouseConst);
  980.         mouseForce[southEast, 1] := TRUNC(0.707 * mouseConst);
  981.         mouseForce[east, 0] := TRUNC(1 * mouseConst);
  982.         mouseForce[east, 1] := 0;
  983.         mouseForce[northEast, 0] := TRUNC(0.707 * mouseConst);
  984.         mouseForce[northEast, 1] := TRUNC(-0.707 * mouseConst);
  985.         mouseForce[north, 0] := 0;
  986.         mouseForce[north, 1] := TRUNC(-1 * mouseConst);
  987.         mouseForce[northWest, 0] := TRUNC(-0.707 * mouseConst);
  988.         mouseForce[northWest, 1] := TRUNC(-0.707 * mouseConst);
  989.         mouseForce[west, 0] := TRUNC(-1 * mouseConst);
  990.         mouseForce[west, 1] := 0;
  991.         mouseForce[southWest, 0] := TRUNC(-0.707 * mouseConst);
  992.         mouseForce[southWest, 1] := TRUNC(0.707 * mouseConst);
  993.         mouseForce[resting, 0] := 0;
  994.         mouseForce[resting, 1] := 0;
  995.     end;
  996.  
  997. {=================================}
  998.  
  999.     function GetGrayRgn: RgnHandle;
  1000.     inline
  1001.         $2EB8, $09EE;
  1002.  
  1003. {=================================}
  1004.  
  1005.     function GetMBarHeight: Integer;
  1006.     inline
  1007.         $3EB8, $0BAA;
  1008.  
  1009. {=================================}
  1010.  
  1011.     procedure SetMBarHeight (newHeight: Integer);
  1012.     inline
  1013.         $31DF, $0BAA;
  1014.  
  1015. {=================================}
  1016.  
  1017.     function GetWindowList: WindowPtr;
  1018.     inline
  1019.         $2EB8, $9D6;
  1020.  
  1021. {=================================}
  1022.  
  1023.     function GetMBarRgn: RgnHandle;
  1024.         var
  1025.             theRect: Rect;
  1026.             worldRgn, mBarRgn: RgnHandle;
  1027.     begin
  1028.         theRect := GetGrayRgn^^.rgnBBox;
  1029.         UnionRect(theRect, screenBits.bounds, theRect);
  1030.         worldRgn := NewRgn;
  1031.         OpenRgn;
  1032.         FrameRoundRect(theRect, 16, 16);
  1033.         CloseRgn(worldRgn);
  1034.  
  1035.         theRect := screenBits.bounds;
  1036.         theRect.bottom := theRect.top + wasMBarHeight;
  1037.         mBarRgn := NewRgn;
  1038.         RectRgn(mBarRgn, theRect);
  1039.         SectRgn(worldRgn, mBarRgn, mBarRgn);
  1040.  
  1041.         DisposeRgn(worldRgn);
  1042.         GetMBarRgn := mBarRgn;
  1043.     end;
  1044.  
  1045. {=================================}
  1046.  
  1047.     procedure HideMenuBar;
  1048.         var
  1049.             theRect: Rect;
  1050.             mBarHeight: Integer;
  1051.             grayRgn, menuBarRgn: RgnHandle;
  1052.             startWindow: WindowPeek;
  1053.     begin
  1054.         mBarHeight := GetMBarHeight;
  1055.         if (mBarHeight <> 0) then
  1056.             begin
  1057.                 grayRgn := GetGrayRgn;
  1058.                 wasMBarHeight := mBarHeight;
  1059.                 menuBarRgn := GetMBarRgn;
  1060.                 SetMBarHeight(0);
  1061.                 UnionRgn(grayRgn, menuBarRgn, grayRgn);
  1062.  
  1063.                 startWindow := WindowPeek(GetWindowList);
  1064.                 PaintBehind(startWindow, menuBarRgn);
  1065.                 CalcVisBehind(startWindow, menuBarRgn);
  1066.                 DisposeRgn(menuBarRgn);
  1067.             end;
  1068.     end;
  1069.  
  1070. {=================================}
  1071.  
  1072.     procedure ShowMenuBar;
  1073.         var
  1074.             grayRgn, menuBarRgn: RgnHandle;
  1075.     begin
  1076.         if (GetMBarHeight = 0) then
  1077.             begin
  1078.                 grayRgn := GetGrayRgn;
  1079.                 menuBarRgn := GetMBarRgn;
  1080.                 SetMBarHeight(wasMBarHeight);
  1081.  
  1082.                 DiffRgn(grayRgn, menuBarRgn, grayRgn);
  1083.                 CalcVisBehind(WindowPeek(GetWindowList), menuBarRgn);
  1084.                 DisposeRgn(menuBarRgn);
  1085.                 DrawMenuBar;
  1086.             end;
  1087.     end;
  1088.  
  1089. {=================================}
  1090.  
  1091. end.